<!DOCTYPE html>
<html>
  <head>
    <title>运车管家后台管理</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <script type="text/javascript" src="/javascripts/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="/javascripts/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/javascripts/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/javascripts/admin/highcharts.js"></script>
      <link rel='stylesheet' href='/javascripts/easyui/themes/bootstrap/easyui.css' />
      <link rel='stylesheet' href='/javascripts/easyui/themes/icon.css' />
      <link rel='stylesheet' href='/javascripts/easyui/themes/color.css' />
  </head>
  <style type="text/css">
    html{height:100%}
    body{height:100%;margin:0px;padding:0px}
    .logo{
      float: left;
      padding-left: 5px;
      font-size: 28px;
    }
    .fontsty{
      font-family: "楷体" ;
      color: #ffffff;
    }
  </style>
  <body  class="easyui-layout">

  <div data-options="region:'north'" style="height: 85px;background-color: #6dbfff;background-repeat:repeat-x;overflow: hidden;"  ><!--text-align: right;-->
    <div class="logo"><img src="/image/bianfuxia.png" style="height: 77px;vertical-align: middle"><span class="fontsty" style="vertical-align: middle;padding-bottom: 10px">&emsp;&emsp;管理系统</span></div>
    <div style="padding: 50px 20px 5px 0px;color: #ffffff;float: right">欢迎您，<%= user.name%>&nbsp;&nbsp;<a onclick="clearAuth()" style="color: red">退出登录</a></div>
  </div>
  <div data-options="region:'west',href:'/admin/layout/west.html'" style="width: 180px"></div>
  <div data-options="region:'center',href:'/admin/layout/center.html'" style="overflow: hidden;fit:true"></div>


  <script>

      localStorage.setItem('token','<%= token%>');
      localStorage.setItem('islogin',true);
      $.fn.panel.defaults.loadingMessage = '       ';

      $.ajaxSetup({
        timeout: 5000,
        dataType: 'html',
        //请求成功后触发
//      success: function (data) { show.append('success invoke!' + data + '<br/>'); },
        //请求失败遇到异常触发
//      error: function (xhr, status, e) { show.append('error invoke! status:' + status+'<br/>'); },
        //完成请求后触发。即在success或error触发后触发
//      complete: function (xhr, status) { show.append('complete invoke! status:' + status+'<br/>'); },
        //发送请求前触发
        beforeSend: function (xhr) {
            if(localStorage.getItem('islogin')=='false'){
                window.location.href='/admin/manage';
            }
            //可以设置自定义标头
            xhr.setRequestHeader('Authorization','Bearer '+localStorage.getItem('token'));//$window.sessionStorage.token

        }
      });

      function clearAuth(){
          localStorage.removeItem('token');
          localStorage.setItem('islogin',false);
          window.location.href='/admin/manage';
      }

    </script>
  </body>
</html>
